import 'package:flutter/material.dart';
import 'package:imember/UI/Notice.dart';
import 'package:imember/Util/MyColor.dart';
import 'package:imember/Util/PageUtil.dart';

import 'MyDialog.dart';
import 'MyImage.dart';

class MyPage extends StatelessWidget {
  MyPage(this.body, {this.title, this.showIcon, this.showNotice});

  bool? showIcon = false;
  bool? showNotice = false;
  String? title = "";
  Widget body;

  @override
  Widget build(BuildContext context) {
    showIcon = showIcon ?? false;
    showNotice = showNotice ?? false;
    return Scaffold(
        //鍵盤彈出後是否改變屏幕大小
        resizeToAvoidBottomInset: true,
        // appBar: AppBar(toolbarHeight: 0, brightness: Brightness.light, backgroundColor: MyColor.Transfer, elevation: 0),
        body: Column(children: [
          Container(
              padding: EdgeInsets.only(left: 20, right: 20),
              height: 84,
              child: Row(
                crossAxisAlignment: CrossAxisAlignment.center,
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  LocalImage("ic_back.png", width: 46, padding: EdgeInsets.all(10), onTap: () {
                    PageUtil().back(context);
                  }),
                  showIcon!
                      ? LocalImage("ic_logo.png", height: 38)
                      : Text(title ?? "", style: TextStyle(fontSize: 25, color: MyColor.Orange,fontWeight: FontWeight.bold)),
                  showNotice!
                      ? LocalImage("ic_notice.png", width: 26, padding: EdgeInsets.all(20), onTap: () {
                          showWidgetDialog(context, Notice(onClose: () {}));
                        })
                      : Container(width: 66),
                ],
              )),
          Container(height: 2, color: MyColor.Orange),
          Expanded(child: body)
        ]));
  }
}
